<!doctype html>
<title>Replacement of window object after document.open</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe></iframe>
<script>
var t = async_test();

onload = t.step_func(function() {
  var iframe = document.getElementsByTagName("iframe")[0];
  iframe.contentWindow.state = 1;
  var handle = iframe.contentWindow;
  iframe.contentDocument.open();
  assert_false("state" in iframe.contentWindow, "Variables are not preserved after document.open");
  assert_equals(iframe.contentWindow.state, undefined, "Variables are not preserved after document.open");
  assert_equals(iframe.contentWindow, handle);
  t.done();
});
</script>
